#ifndef __MEXPR__
#define __MEXPR__

@class MMathLink;

@interface MExpr : NSObject
{
}

+ (MExpr*) exprWithString: (NSString*) string;
+ (MExpr*) exprWithSymbol: (NSString*) symbol;
+ (MExpr*) exprWithData: (NSData*) data;
+ (MExpr*) exprWithNumber: (NSNumber*) number;
+ (MExpr*) exprWithInteger: (int) integer;
+ (MExpr*) exprWithReal: (double) real;
+ (MExpr*) exprWithFunctionParts: (NSArray*) parts;
+ (MExpr*) exprWithFunctionHead: (MExpr*) head, ...;
+ (MExpr*) exprWithFunctionName: (NSString*) name, ...;
+ (MExpr*) exprWithFunctionName: (NSString*) name link: (MMathLink*) link;
+ (MExpr*) exprWithLink: (MMathLink*) link;

- (NSString*) string;
- (NSString*) symbol;
- (NSNumber*) number;
- (NSNumber*) integer;
- (NSNumber*) real;
- (int) functionLength;
- (MExpr*) functionPart: (int) thePart;
- (BOOL) checkHead: (MExpr*) head;
- (BOOL) checkFunction: (MExpr*) head length: (int*) length;
- (BOOL) put: (MMathLink*) link;

@end

#ifdef __cplusplus
extern "C" {
#endif

/* convenience functions */
extern MExpr* MString(NSString* string);
extern MExpr* MSymbol(NSString* symbol);
extern MExpr* MInteger(long integer);
extern MExpr* MReal(double real);
extern MExpr* MFunction(MExpr* head, ...);

#ifdef __cplusplus
}
#endif

#endif /* __MEXPR__ */
